/**  
* @Title: PurchaseController.java  
* @Description: TODO(用一句话描述该文件做什么)  
* @author 张鑫
* @phone 17561783855  
* @date 2019年4月8日  
*/
package com.fortune.rainshineservice.controller;

import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.model.service.OrderModel;
import com.fortune.rainshinecommon.model.service.StockModel;
import com.fortune.rainshinecommon.query.StockQuery;
import com.fortune.rainshineservice.service.PurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**  
* @ClassName: PurchaseController  
* @Description: TODO(这里用一句话描述这个类的作用)  
* @author 张鑫
* @phone 17561783855
* @date 2019年4月8日  
*    
*/
@RestController
@RequestMapping("/purchase")
public class PurchaseController {
	@Autowired
    private PurchaseService service;

	/**
	 * 下单
	 * @param model
	 * @return
	 */
	@PostMapping("/order")
    public MsgModel order(@RequestBody OrderModel model){
        return service.order(model);
    }
	
	/**
	 * @Title: getStockProducts
	 * @Description: 获取上级店铺的库存信息
	 * @author zhangxin
	 * @phone 17561783855
	 * @date 2019年5月6日
	 */
	@PostMapping(value = "/products")
	public List<StockModel> getStockProducts(@RequestBody String shopId){
		return service.getStockProducts(shopId);
	}

	@PostMapping(value = "/getStockProductList")
	public MsgModel getStockProductList(@RequestBody StockQuery query){
		return service.getStockProductList(query);
	}
}
